package br.com.comdoc.telas;

//@author Jorge
import br.com.comdoc.engine.Engine;
import br.com.comdoc.entidade.Empresa;
import br.com.comdoc.fachada.FachadaEmpresa;
import br.com.comdoc.interfaces.InterfaceContato;
import br.com.comdoc.interfaces.InterfaceEmpresa;
import br.com.comdoc.interfaces.InterfaceEndereco;
import br.com.comdoc.repositorio.RepositorioContato;
import br.com.comdoc.repositorio.RepositorioEndereco;
import java.awt.Color;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CadastroEmpresas extends javax.swing.JDialog {

    public CadastroEmpresas(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        Engine.darFocoJComponent(this, cnpj);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        salvar = new javax.swing.JButton();
        status = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        nomeFantazia = new javax.swing.JTextField();
        cadastrarApenas = new javax.swing.JRadioButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        ie = new javax.swing.JFormattedTextField();
        jPanel1 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        estado = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        pais = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        cep = new javax.swing.JFormattedTextField();
        endereco = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        cidade = new javax.swing.JTextField();
        bairro = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        cargoContato1 = new javax.swing.JFormattedTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        telefoneContato1 = new javax.swing.JFormattedTextField();
        jLabel22 = new javax.swing.JLabel();
        emailContato1 = new javax.swing.JFormattedTextField();
        nomeContato1 = new javax.swing.JFormattedTextField();
        jPanel7 = new javax.swing.JPanel();
        cargoContato2 = new javax.swing.JFormattedTextField();
        nomeContato2 = new javax.swing.JFormattedTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        telefoneContato2 = new javax.swing.JFormattedTextField();
        jLabel26 = new javax.swing.JLabel();
        emailContato2 = new javax.swing.JFormattedTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        reservar = new javax.swing.JRadioButton();
        razaoSocial = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        cnpj = new javax.swing.JFormattedTextField();
        jPanel8 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setUndecorated(true);

        jPanel5.setBackground(new java.awt.Color(102, 102, 102));
        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)));

        jPanel6.setBackground(new java.awt.Color(102, 102, 102));
        jPanel6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPanel6MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jPanel6MouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jPanel6MouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 43, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        salvar.setBackground(new java.awt.Color(102, 102, 102));
        salvar.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
        salvar.setForeground(new java.awt.Color(255, 204, 0));
        salvar.setText("Salvar");
        salvar.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        salvar.setContentAreaFilled(false);
        salvar.setFocusPainted(false);
        salvar.setNextFocusableComponent(cnpj);
        salvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvarActionPerformed(evt);
            }
        });

        status.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        status.setForeground(new java.awt.Color(255, 204, 0));
        status.setText("*Status");

        jPanel3.setBackground(new java.awt.Color(102, 102, 102));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)), "Cadastro de empresas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft JhengHei", 1, 14), new java.awt.Color(255, 255, 255))); // NOI18N

        nomeFantazia.setBackground(new java.awt.Color(102, 102, 102));
        nomeFantazia.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        nomeFantazia.setForeground(new java.awt.Color(255, 255, 255));
        nomeFantazia.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        nomeFantazia.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        nomeFantazia.setSelectionColor(new java.awt.Color(255, 204, 0));

        cadastrarApenas.setBackground(new java.awt.Color(102, 102, 102));
        buttonGroup1.add(cadastrarApenas);
        cadastrarApenas.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        cadastrarApenas.setForeground(new java.awt.Color(255, 204, 0));
        cadastrarApenas.setSelected(true);
        cadastrarApenas.setText("Cadastrar Apenas");

        jLabel11.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(255, 204, 0));
        jLabel11.setText("Inscrição Estadual");

        jLabel18.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel18.setForeground(new java.awt.Color(255, 204, 0));
        jLabel18.setText("Situação da empresa");

        ie.setBackground(new java.awt.Color(102, 102, 102));
        ie.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        ie.setForeground(new java.awt.Color(255, 255, 255));
        ie.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)), "Endereço", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft JhengHei", 0, 10), new java.awt.Color(255, 255, 255))); // NOI18N

        jLabel12.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel12.setForeground(new java.awt.Color(255, 204, 0));
        jLabel12.setText("Bairro");

        jLabel13.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel13.setForeground(new java.awt.Color(255, 204, 0));
        jLabel13.setText("Endereço");

        estado.setBackground(new java.awt.Color(102, 102, 102));
        estado.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        estado.setForeground(new java.awt.Color(102, 102, 102));
        estado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Acre", "Alagoas", "Amapá", "Amazonas", "Bahia", "Ceará", "Distrito Federal", "Espírito Santo", "Goiás", "Maranhão", "Mato Grosso", "Mato Grosso do Sul", "Minas Gerais", "Pará", "Paraíba", "Paraná", "Pernambuco", "Piauí", "Rio de Janeiro", "Rio Grande do Norte", "Rio Grande do Sul", "Rondônia", "Roraima", "Santa Catarina", "São Paulo", "Sergipe", "Tocantins" }));
        estado.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));

        jLabel16.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel16.setForeground(new java.awt.Color(255, 204, 0));
        jLabel16.setText("País");

        jLabel17.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel17.setForeground(new java.awt.Color(255, 204, 0));
        jLabel17.setText("UF");

        pais.setBackground(new java.awt.Color(102, 102, 102));
        pais.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        pais.setForeground(new java.awt.Color(255, 255, 255));
        pais.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        pais.setNextFocusableComponent(nomeContato1);
        pais.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        pais.setSelectionColor(new java.awt.Color(255, 204, 0));

        jLabel14.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel14.setForeground(new java.awt.Color(255, 204, 0));
        jLabel14.setText("CEP");

        cep.setBackground(new java.awt.Color(102, 102, 102));
        cep.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        cep.setForeground(new java.awt.Color(255, 255, 255));
        cep.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        endereco.setBackground(new java.awt.Color(102, 102, 102));
        endereco.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        endereco.setForeground(new java.awt.Color(255, 255, 255));
        endereco.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        endereco.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        endereco.setSelectionColor(new java.awt.Color(255, 204, 0));

        jLabel15.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(255, 204, 0));
        jLabel15.setText("Cidade");

        cidade.setBackground(new java.awt.Color(102, 102, 102));
        cidade.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        cidade.setForeground(new java.awt.Color(255, 255, 255));
        cidade.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        cidade.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        cidade.setSelectionColor(new java.awt.Color(255, 204, 0));

        bairro.setBackground(new java.awt.Color(102, 102, 102));
        bairro.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        bairro.setForeground(new java.awt.Color(255, 255, 255));
        bairro.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        bairro.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        bairro.setSelectionColor(new java.awt.Color(255, 204, 0));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(endereco)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cep, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)
                            .addComponent(jLabel13))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel12)
                            .addComponent(bairro, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel17)
                            .addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLabel15)
                                .addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLabel16)
                                .addComponent(pais, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel14)
                .addGap(8, 8, 8)
                .addComponent(cep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(endereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jPanel2.setBackground(new java.awt.Color(102, 102, 102));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)), "Contato", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft JhengHei", 0, 10), new java.awt.Color(255, 255, 255))); // NOI18N

        jPanel4.setBackground(new java.awt.Color(102, 102, 102));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)), "Contato 1", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft JhengHei", 0, 10), new java.awt.Color(255, 255, 255))); // NOI18N

        cargoContato1.setBackground(new java.awt.Color(102, 102, 102));
        cargoContato1.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        cargoContato1.setForeground(new java.awt.Color(255, 255, 255));
        cargoContato1.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        jLabel10.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(255, 204, 0));
        jLabel10.setText("Nome do contato");

        jLabel21.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel21.setForeground(new java.awt.Color(255, 204, 0));
        jLabel21.setText("E-mail do contato");

        jLabel20.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel20.setForeground(new java.awt.Color(255, 204, 0));
        jLabel20.setText("Cargo do contato");

        telefoneContato1.setBackground(new java.awt.Color(102, 102, 102));
        telefoneContato1.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        telefoneContato1.setForeground(new java.awt.Color(255, 255, 255));
        telefoneContato1.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        jLabel22.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel22.setForeground(new java.awt.Color(255, 204, 0));
        jLabel22.setText("Telefone do contato");

        emailContato1.setBackground(new java.awt.Color(102, 102, 102));
        emailContato1.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        emailContato1.setForeground(new java.awt.Color(255, 255, 255));
        emailContato1.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        nomeContato1.setBackground(new java.awt.Color(102, 102, 102));
        nomeContato1.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        nomeContato1.setForeground(new java.awt.Color(255, 255, 255));
        nomeContato1.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        nomeContato1.setRequestFocusEnabled(false);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(nomeContato1)
                                .addGap(18, 18, 18)))
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20)
                            .addComponent(cargoContato1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel22)
                            .addComponent(telefoneContato1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, Short.MAX_VALUE)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel21)
                            .addComponent(emailContato1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cargoContato1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(nomeContato1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(24, 24, 24)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(emailContato1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(telefoneContato1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7.setBackground(new java.awt.Color(102, 102, 102));
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 255, 255)), "Contato 2", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft JhengHei", 0, 10), new java.awt.Color(255, 255, 255))); // NOI18N

        cargoContato2.setBackground(new java.awt.Color(102, 102, 102));
        cargoContato2.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        cargoContato2.setForeground(new java.awt.Color(255, 255, 255));
        cargoContato2.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        nomeContato2.setBackground(new java.awt.Color(102, 102, 102));
        nomeContato2.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        nomeContato2.setForeground(new java.awt.Color(255, 255, 255));
        nomeContato2.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        jLabel23.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel23.setForeground(new java.awt.Color(255, 204, 0));
        jLabel23.setText("Nome do contato");

        jLabel24.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel24.setForeground(new java.awt.Color(255, 204, 0));
        jLabel24.setText("E-mail do contato");

        jLabel25.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel25.setForeground(new java.awt.Color(255, 204, 0));
        jLabel25.setText("Cargo do contato");

        telefoneContato2.setBackground(new java.awt.Color(102, 102, 102));
        telefoneContato2.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        telefoneContato2.setForeground(new java.awt.Color(255, 255, 255));
        telefoneContato2.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N

        jLabel26.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel26.setForeground(new java.awt.Color(255, 204, 0));
        jLabel26.setText("Telefone do contato");

        emailContato2.setBackground(new java.awt.Color(102, 102, 102));
        emailContato2.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        emailContato2.setForeground(new java.awt.Color(255, 255, 255));
        emailContato2.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        emailContato2.setNextFocusableComponent(cadastrarApenas);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel23)
                            .addComponent(nomeContato2, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel25)
                            .addComponent(cargoContato2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel26)
                            .addComponent(telefoneContato2, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel24)
                            .addComponent(emailContato2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cargoContato2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nomeContato2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(emailContato2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(telefoneContato2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/comdoc/imagens/Consulta.png"))); // NOI18N
        jLabel5.setToolTipText("Consultar se cliente já existe");

        jLabel8.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 204, 0));
        jLabel8.setText("Nome Fantazia");

        reservar.setBackground(new java.awt.Color(102, 102, 102));
        buttonGroup1.add(reservar);
        reservar.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        reservar.setForeground(new java.awt.Color(255, 204, 0));
        reservar.setText("Reservar");
        reservar.setNextFocusableComponent(salvar);

        razaoSocial.setBackground(new java.awt.Color(102, 102, 102));
        razaoSocial.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        razaoSocial.setForeground(new java.awt.Color(255, 255, 255));
        razaoSocial.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        razaoSocial.setSelectedTextColor(new java.awt.Color(102, 102, 102));
        razaoSocial.setSelectionColor(new java.awt.Color(255, 204, 0));

        jLabel9.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 204, 0));
        jLabel9.setText("Razão Social");

        jLabel19.setFont(new java.awt.Font("Microsoft JhengHei", 0, 10)); // NOI18N
        jLabel19.setForeground(new java.awt.Color(255, 204, 0));
        jLabel19.setText("CNPJ");

        cnpj.setBackground(new java.awt.Color(102, 102, 102));
        cnpj.setBorder(javax.swing.BorderFactory.createEtchedBorder(null, new java.awt.Color(255, 204, 0)));
        cnpj.setForeground(new java.awt.Color(255, 255, 255));
        cnpj.setFont(new java.awt.Font("Microsoft JhengHei", 0, 12)); // NOI18N
        cnpj.requestFocus();

        cnpj.grabFocus();

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(nomeFantazia)
                    .addComponent(razaoSocial)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(cnpj, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel5))
                            .addComponent(jLabel19))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11)
                            .addComponent(ie, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel18)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(cadastrarApenas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(reservar))
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cadastrarApenas)
                            .addComponent(reservar)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(jLabel19))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(ie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cnpj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nomeFantazia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(razaoSocial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(14, 14, 14))
        );

        jPanel8.setBackground(new java.awt.Color(102, 102, 102));
        jPanel8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPanel8MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jPanel8MouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jPanel8MouseExited(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 204, 0));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("X");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel3)
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(65, 65, 65)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(status)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(salvar, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(status)
                    .addComponent(salvar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        setSize(new java.awt.Dimension(852, 500));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jPanel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel6MouseClicked
        this.dispose();
    }//GEN-LAST:event_jPanel6MouseClicked

    private void jPanel6MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel6MouseExited
        this.jPanel6.setBackground(new Color(102, 102, 102));
    }//GEN-LAST:event_jPanel6MouseExited

    private void jPanel6MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel6MouseEntered
        this.jPanel6.setBackground(Color.red);
    }//GEN-LAST:event_jPanel6MouseEntered

    private void jPanel8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel8MouseClicked
        this.dispose();
    }//GEN-LAST:event_jPanel8MouseClicked

    private void jPanel8MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel8MouseExited
        this.jPanel8.setBackground(new Color(102, 102, 102));
    }//GEN-LAST:event_jPanel8MouseExited

    private void jPanel8MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel8MouseEntered
        this.jPanel8.setBackground(Color.red);
    }//GEN-LAST:event_jPanel8MouseEntered

    private void salvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvarActionPerformed
        //endereco
        int idEndereco = 0;
        String cep_ref = this.cep.getText();
        String endereco_ref = this.endereco.getText();
        String bairro_ref = this.bairro.getText();
        String cidade_ref = this.cidade.getText();
        String estado_ref = this.estado.getSelectedItem().toString();
        String pais_ref = this.pais.getText();
        InterfaceEndereco fachaEndereco = new RepositorioEndereco();
        try {
            fachaEndereco.salvarEndereco(endereco_ref, cep_ref, bairro_ref, cidade_ref, 
                    estado_ref, pais_ref);
            idEndereco = fachaEndereco.returnIdEndereco();
        } catch (ClassNotFoundException | SQLException ex) {
            Logger.getLogger(CadastroEmpresas.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        //contato
        int idContato_ref = 0;
        String nomeContato1_ref = this.nomeContato1.getText();
        String nomeContato2_ref = this.nomeContato2.getText();
        String cargoContato1_ref = this.cargoContato1.getText();
        String cargoContato2_ref = this.cargoContato2.getText();
        String telefoneContato1_ref = this.telefoneContato1.getText();
        String telefoneContato2_ref = this.telefoneContato2.getText();
        String emailContato1_ref = this.emailContato1.getText();
        String emailContato2_ref = this.emailContato2.getText();
        InterfaceContato fachaContato = new RepositorioContato();
        try {
            fachaContato.salvarContato(nomeContato1_ref, nomeContato2_ref, cargoContato1_ref, 
                    cargoContato2_ref, telefoneContato1_ref, telefoneContato2_ref, 
                    emailContato1_ref, emailContato2_ref);
            idContato_ref = fachaContato.returnIdContato();
        } catch (ClassNotFoundException | SQLException ex) {
            Logger.getLogger(CadastroEmpresas.class.getName()).log(Level.SEVERE, null, ex);
        }
        
         //empresa
        int situacaoEmpresa = 0;
        String cnpj_ref = CadastroEmpresas.cnpj.getText();
        String ie_ref = this.ie.getText();
        String razaoSocial_ref = this.razaoSocial.getText();
        String nomeFantazia_ref = this.nomeFantazia.getText();
        if(this.cadastrarApenas.isSelected() && !this.reservar.isSelected()){
            situacaoEmpresa = 1;
        }
        if(!this.cadastrarApenas.isSelected() && this.reservar.isSelected()){
            situacaoEmpresa = 2;
        }
        InterfaceEmpresa fachaEmpresa = new FachadaEmpresa();
        fachaEmpresa.salvar(idEndereco, idContato_ref, razaoSocial_ref, nomeFantazia_ref, 
                cnpj_ref, ie_ref, situacaoEmpresa);
        
    }//GEN-LAST:event_salvarActionPerformed

    public static void main(String args[]) {

        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastroEmpresas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                CadastroEmpresas dialog = new CadastroEmpresas(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);                        
                    }
                });
                
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField bairro;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JRadioButton cadastrarApenas;
    private javax.swing.JFormattedTextField cargoContato1;
    private javax.swing.JFormattedTextField cargoContato2;
    private javax.swing.JFormattedTextField cep;
    private javax.swing.JTextField cidade;
    public static javax.swing.JFormattedTextField cnpj;
    private javax.swing.JFormattedTextField emailContato1;
    private javax.swing.JFormattedTextField emailContato2;
    private javax.swing.JTextField endereco;
    private javax.swing.JComboBox estado;
    private javax.swing.JFormattedTextField ie;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JFormattedTextField nomeContato1;
    private javax.swing.JFormattedTextField nomeContato2;
    private javax.swing.JTextField nomeFantazia;
    private javax.swing.JTextField pais;
    private javax.swing.JTextField razaoSocial;
    private javax.swing.JRadioButton reservar;
    private javax.swing.JButton salvar;
    private javax.swing.JLabel status;
    private javax.swing.JFormattedTextField telefoneContato1;
    private javax.swing.JFormattedTextField telefoneContato2;
    // End of variables declaration//GEN-END:variables
}
